package CountDownLatch;

/**
 *
 * 枚举类
 *
 * @author shkstart
 * @create 2021-03-24 11:21
 */
public enum CountryEnum {
//定义枚举
    ONE(1,"韩"),TWO(2,"楚"),THREE(3,"赵"),FOUR(4,"魏"),FIVE(5,"齐"),SIX(6,"燕"),
    ;
//    枚举属性
    private int Code;
    private String  Message;

    CountryEnum(int code, String message) {
       this.Code = code;
       this.Message = message;
    }

    public String getMessage() {
        return Message;
    }

    public int getCode() {
        return Code;
    }

    public static CountryEnum forEach(int index){
        CountryEnum[] values = CountryEnum.values();   //获取到全部枚举
        for( CountryEnum ss :values){      //遍历出所有枚举 ONE...等
         if(index == ss.getCode()){        //获取到枚举中的一个属性

             return ss;                      //返回一个枚举对象
         }
        }
        return null;
    }

}
